package com.itheima.tlias.service.impl;

import com.github.pagehelper.PageHelper;
import com.itheima.tlias.mapper.StudentMapper;
import com.itheima.tlias.pojo.Student;
import com.itheima.tlias.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private final StudentMapper studentMapper;

    private StudentServiceImpl(StudentMapper studentMapper) {
        this.studentMapper = studentMapper;
    }

    @Override
    public List<Student> queryStudent(Student student, int page, int pageSize) {
        PageHelper.startPage(page, pageSize);
        return studentMapper.queryStudent(student);
    }

    @Override
    public Integer delete(List<Integer> ids) {
        return studentMapper.delete(ids);
    }

    @Override
    public Integer insert(Student student) {
        return studentMapper.insert(student);
    }

    @Override
    public Integer update(Student student) {
        return studentMapper.update(student);
    }

    @Override
    public Student getById(Integer id) {
        return studentMapper.getById(id);
    }
}
